package com.coda.mapper;

import com.coda.annotation.AutoFill;
import com.coda.entity.PaymentType;
import com.coda.enumeration.OperationType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;


@Mapper
public interface PaymentTypeMapper {
    /**
     * 查询所有支付方式
     * @return
     */
    List<PaymentType> getPaymentList();

    /**
     * 添加支付方式
     * @param paymentType
     */
    @AutoFill(OperationType.INSERT)
    void insert(PaymentType paymentType);


    /**
     * 更新支付方式
     * @param paymentType
     */
    @AutoFill(OperationType.UPDATE)
    void update(PaymentType paymentType);

    /**
     * 根据id删除支付方式
     * @param id
     */
    @Delete("delete from payment_type where id = #{id}")
    void delete(Long id);

    /**
     * 获取所有的支付方式信息
     * @param paymentTypeId
     */
    @Select("select * from payment_type where id = #{paymentTypeId}")
    PaymentType getPaymentType(Long paymentTypeId);
}
